<?php
/** 
 * 订单售后
 *
 * @author   xionggan
 * @date     2019-09-17
 */

namespace app\common\model;

use think\Db;
use think\Model;

class CoreOrderService extends Model
{
    protected $name  = 'core_order_service';
    protected $error = null;
    // 追加属性
    protected $append = [];

    const STATUS_0  = 0;
    const STATUS_1  = 1;
    const STATUS_2  = 2;
    const STATUS_3  = 3;
    const STATUS_4  = 4;
    const STATUS_5  = 5;
    const STATUS_6  = 6;
    const STATUS_7  = 7;

    const RETURN_PRO_NO     = 0;
    const RETURN_PRO_YES    = 1;

    /**
     * 获取错误信息
     * @return  string   错误信息
     */
    public function getError()
    {
        return $this->error;
    }

    /**
     * 获取售后状态映射
     * @return  array   状态映射表
     */
    public function getStatusMap()
    {
        return [
            self::STATUS_0  => '待审核',
            self::STATUS_1  => '待退货',
            self::STATUS_2  => '待收货',
            self::STATUS_3  => '待退款',
            self::STATUS_4  => '已完成',
            self::STATUS_5  => '已拒绝',
            self::STATUS_6  => '已取消',
            self::STATUS_7  => '退款中',
        ];
    }

    /**
     * 获取退货状态映射
     * @return  array   状态映射表
     */
    public function getReturnProductMap()
    {
        return [
            self::RETURN_PRO_NO     => '仅退款',
            self::RETURN_PRO_YES    => '退货退款',
        ];
    }
    
}
